#include <tchar.h>
#include "Point.h"
#include "Circle.h"
#include "List.h"
#include <fstream>

#define	  stop __asm nop

int main()
{
	Point p1(3, 4);
	Circle c1 (p1, 4);
	Circle c2 (1, 2, 3);
	Circle c3(5, 6, 7);
	Circle c4(10,10,10);
	Circle c5;
	Circle c6(1, 2, 3);
	Circle c7(1, 2, 3);

	List list1;
	list1.Ad_to(List::TO::to_tail, c1);
	list1.Ad_to(List::TO::to_head, c2 );
	list1.Ad_to(List::TO::to_tail, c3);
	list1.Ad_to(List::TO::to_tail, c4);
	list1.Ad_to(List::TO::to_head, c5);
	list1.Ad_to(List::TO::to_tail, c6);
	list1.Ad_to(List::TO::to_head, c7);
	
	/*int removed = list1.Remove_all_match(Circle(1,2,3));
	std::cout << list1;
	std::cout << "Remove: "<<removed<<" nodes.\n\n";*/
	stop
	
	List list2;
	list2 = list1;
	std::cout << list2;

	list1.Remove_list();
	list1.Ad_to(List::TO::to_tail, Circle(8, 4, 2));
	list1.Ad_to(List::TO::to_tail, Circle(7, 11, 18));
	list1.Ad_to(List::TO::to_tail, Circle(5, 4, 33));
	list1.Ad_to(List::TO::to_tail, Circle(16, 41, 20));
	std::cout << list1;

	
	/*List list3;
	list3 = std::move(list1);
	std::cout << list3;
	std::cout << list1;*/
	
	list1.Sort_list();
	std::cout << list1;
	list2.Sort_list();
	std::cout << list2;

	int removed = list2.Remove_all_match(Circle(0, 0, 0));
	std::ofstream file ("List.txt");
	file << list2;
	
	List list3;
	std::ifstream fin("List.txt");
	if (fin.is_open())
	{
		fin >> list3;	}
	else { std::cout << "Error opening file to read " << std::endl; }
	fin.close();
	std::cout << list3;

	stop
	return 0;
}
